<%@ page contentType="text/html; charset=UTF-8" %>
<%@include file="/html/portlet/line/init.jsp"%>

<liferay-portlet:actionURL portletConfiguration="true"
	var="configurationURL" />
<portlet:renderURL windowState="<%= LiferayWindowState.EXCLUSIVE.toString() %>" var="add_chart_series">
	<portlet:param name="jspPage" value="/html/portlet/line/add_chart_series.jsp"/>
</portlet:renderURL>
<liferay-ui:tabs names="chart.config,display-settings"
	refresh="<%=false%>">
	<aui:form action="<%=configurationURL%>" method="post" name="fm">
		<liferay-ui:section>
			<liferay-ui:error-marker key="errorSection" value="chart.config" />

			<aui:input name="<%=Constants.CMD%>" type="hidden"
				value="<%=Constants.UPDATE%>" />
			<liferay-ui:panel-container extended="true" persistState="<%= true %>" >
				<liferay-ui:panel collapsible="<%=true%>" extended="<%=true%>"
					id="<portlet:namespace />chart-title" persistState="<%=true%>"
					title="chart.title">
					<aui:input label="chart.title.text"
						name="preferences--chart_title_text--"
						value="<%=chart_title_text%>" required="true"/>
					<aui:select label="chart.tooltip.trigger"
						name="preferences--chart_tooltip_trigger--">
						<aui:option label="chart.tooltip.trigger.axis" value="axis"
							selected='<%=chart_tooltip_trigger.equals("axis")%>' />
						<aui:option label="chart.tooltip.trigger.item" value="item"
							selected='<%=chart_tooltip_trigger.equals("item")%>' />
					</aui:select>
				
				</liferay-ui:panel>
				<liferay-ui:panel collapsible="<%=true%>" extended="<%=true%>"
					id="<portlet:namespace />chart-legend" persistState="<%=true%>"
					title="chart.legend">
					<aui:input label="chart.legend.show" name="preferences--chart_legend_show--"
						type="checkbox" value="<%=chart_legend_show %>" />
					<aui:select label="chart.legend.orient"
						name="preferences--chart_legend_orient--">
						<aui:option label="chart.legend.orient.horizontal" value="horizontal"
							selected='<%=chart_legend_orient.equals("horizontal")%>' />
						<aui:option label="chart.legend.orient.vertical" value="vertical"
							selected='<%=chart_legend_orient.equals("vertical")%>' />
					</aui:select>
				</liferay-ui:panel>
				<liferay-ui:panel collapsible="<%=true%>" extended="<%=true%>"
					id="<portlet:namespace />chart-xAxis" persistState="<%=true%>"
					title="chart.xAxis">
					<aui:select label="chart.xAxis.type"
						name="preferences--chart_xAxis_type--">
						<aui:option label="chart.xAxis.type.category" value="category"
							selected='<%=chart_xAxis_type.equals("category")%>' />
						<aui:option label="chart.xAxis.type.value" value="value"
							selected='<%=chart_xAxis_type.equals("value")%>' />
						<aui:option label="chart.xAxis.type.time" value="time"
							selected='<%=chart_xAxis_type.equals("time")%>' />
						<aui:option label="chart.xAxis.type.log" value="log"
							selected='<%=chart_xAxis_type.equals("log")%>' />
					</aui:select>
					<aui:input label="chart.xAxis.data" name="preferences--chart_xAxis_data--"
						value="<%=chart_xAxis_data %>" />
				</liferay-ui:panel>
				<liferay-ui:panel collapsible="<%=true%>" extended="<%=true%>"
					id="<portlet:namespace />chart-yAxis" persistState="<%=true%>"
					title="chart.yAxis">
					<aui:select label="chart.yAxis.type"
						name="preferences--chart_yAxis_type--">
						<aui:option label="chart.yAxis.type.value" value="value"
							selected='<%=chart_yAxis_type.equals("value")%>' />
						<aui:option label="chart.yAxis.type.category" value="category"
							selected='<%=chart_yAxis_type.equals("category")%>' />
						<aui:option label="chart.yAxis.type.time" value="time"
							selected='<%=chart_yAxis_type.equals("time")%>' />
						<aui:option label="chart.yAxis.type.log" value="log"
							selected='<%=chart_yAxis_type.equals("log")%>' />
					</aui:select>
				</liferay-ui:panel>
				
				<liferay-ui:panel collapsible="<%=true%>" extended="<%=true%>"
					id="<portlet:namespace />chart-series" persistState="<%=true%>"
					title="chart.series">
					<div id="<portlet:namespace />chart-series-fields">
						<aui:fieldset label="">
							<%
							for (int chart_series_index : chart_series_indexes) {
								//request.setAttribute("config.jsp-index", String.valueOf(chart_series_index));
								String chart_series_name = PrefsParamUtil.getString(portletPreferences, request, "chart_series_name"+chart_series_index);
							%>
								<div class="lfr-form-row lfr-form-row-inline">
									<div class="row-fields" style="display: flex;">
										<aui:input name='<%="chart_series_name" + String.valueOf(chart_series_index)%>' label="First Name" value="<%=chart_series_name %>"/>
									</div>
								</div>
							<%
							}
							%>
						</aui:fieldset>
					</div>
					<aui:script>
						AUI().use('liferay-auto-fields', function(A) {
							new Liferay.AutoFields({
								contentBox : '#<portlet:namespace />chart-series-fields > fieldset',
								fieldIndexes : '<portlet:namespace />chart_series_indexes'
							}).render();
						});
					</aui:script>
				</liferay-ui:panel>
			</liferay-ui:panel-container>
		</liferay-ui:section>
		<liferay-ui:section>
			<liferay-ui:error-marker key="errorSection" value="display-settings" />
			<liferay-ui:panel-container extended="true" accordion="true" >
				<liferay-ui:panel collapsible="<%=true%>" extended="<%=true%>"
					id="<portlet:namespace />chart-toolbox" persistState="<%=true%>"
					title="chart.toolbox">
					
				</liferay-ui:panel>
			</liferay-ui:panel-container>
		</liferay-ui:section>
		<aui:button-row>
			<aui:button type="submit" />
		</aui:button-row>
	</aui:form>
</liferay-ui:tabs>
